package org.qiyu.live.user.provider.rpc;

import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;
import org.qiyu.live.user.interfaces.IUserRpc;
import org.qiyu.live.user.dto.UserDTO;
import org.qiyu.live.user.provider.service.IUserService;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-09-12
 * Time: 17:12
 */
@DubboService // 实现dubbo服务
public class UserRpcImpl implements IUserRpc {
    @Resource
    private IUserService userService;

    @Override
    public String test() {
        System.out.println("this is Dubbo test");
        return "success";
    }

    @Override
    public UserDTO getUserInfo(Long userId) {
        return userService.getUserInfo(userId);
    }

    @Override
    public boolean updateUserInfo(UserDTO userDTO) {
        return userService.updateUserInfo(userDTO);
    }

    @Override
    public boolean insertOne(UserDTO userDTO) {
        return userService.insertOne(userDTO);
    }

    @Override
    public Map<Long, UserDTO> batchQueryUserInfo(List<Long> userIdList) {
        return userService.batchQueryUserInfo(userIdList);
    }
}